import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
    {   // 登录页面
        path:'/',
        name:'login',
        component:()=> import('@/pages/login/login.vue')
    },
    {   // 主页面
        path:'/index',
        name:'index',
        component:()=> import('@/pages/index/index.vue'),
        redirect:'/data',
        children:[
            {   //二级子路由
                path:'/userpage',
                name:'username',
                component:()=> import('../pages/user-page/user.vue')
            },
            {   //订单管理
                path:'/order',
                name:'order',
                component:()=> import('../pages/order/order.vue')
            },
            {   //菜品管理
                path:'/dishes',
                name:'dishes',
                component:()=> import('../pages/dishes/dishes.vue')
            },
            {   // 上传菜品
                path:'/upload',
                name:'upload',
                component:()=> import('../pages/dishes-upload/upload.vue')
            },
            {   //员工详情
                path: '/role',
                name: 'role',
                component: () => import('../pages/role-manage/role.vue')
            },
            {   //数据分析
                path: '/data',
                name: 'data',
                component: () => import('../pages/data-analysis/data.vue')
            }
        ]
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router